3.1.3 \(\int \sin (x) (a \cos (x)+b \sin (x)) \, dx\) [3]

Optimal. Leaf size=25 \[ \frac {b x}{2}-\frac {1}{2} b \cos (x) \sin (x)+\frac {1}{2} a \sin ^2(x) \]

[Out]

1/2*b*x-1/2*b*cos(x)*sin(x)+1/2*a*sin(x)^2

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 25, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, integrand size = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.417, Rules used = {3168, 2644, 30, 2715, 8} \begin {gather*} \frac {1}{2} a \sin ^2(x)+\frac {b x}{2}-\frac {1}{2} b \sin (x) \cos (x) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Sin[x]*(a*Cos[x] + b*Sin[x]),x]

[Out]

(b*x)/2 - (b*Cos[x]*Sin[x])/2 + (a*Sin[x]^2)/2

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2644

Int[cos[(e_.) + (f_.)*(x_)]^(n_.)*((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> Dist[1/(a*f), Subst[Int[
x^m*(1 - x^2/a^2)^((n - 1)/2), x], x, a*Sin[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n - 1)/2] &&
 !(IntegerQ[(m - 1)/2] && LtQ[0, m, n])

Rule 2715

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d*x]*((b*Sin[c + d*x])^(n - 1)/(d*n))
, x] + Dist[b^2*((n - 1)/n), Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integ
erQ[2*n]

Rule 3168

Int[sin[(c_.) + (d_.)*(x_)]^(m_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_.), x_Sym
bol] :> Int[ExpandTrig[sin[c + d*x]^m*(a*cos[c + d*x] + b*sin[c + d*x])^n, x], x] /; FreeQ[{a, b, c, d}, x] &&
 IntegerQ[m] && IGtQ[n, 0]

Rubi steps

\begin {align*} \int \sin (x) (a \cos (x)+b \sin (x)) \, dx &=\int \left (a \cos (x) \sin (x)+b \sin ^2(x)\right ) \, dx\\ &=a \int \cos (x) \sin (x) \, dx+b \int \sin ^2(x) \, dx\\ &=-\frac {1}{2} b \cos (x) \sin (x)+a \text {Subst}(\int x \, dx,x,\sin (x))+\frac {1}{2} b \int 1 \, dx\\ &=\frac {b x}{2}-\frac {1}{2} b \cos (x) \sin (x)+\frac {1}{2} a \sin ^2(x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.01, size = 25, normalized size = 1.00 \begin {gather*} \frac {b x}{2}-\frac {1}{2} a \cos ^2(x)-\frac {1}{4} b \sin (2 x) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Sin[x]*(a*Cos[x] + b*Sin[x]),x]

[Out]

(b*x)/2 - (a*Cos[x]^2)/2 - (b*Sin[2*x])/4

________________________________________________________________________________________

Maple [A]
time = 0.04, size = 21, normalized size = 0.84

method result size
risch \(\frac {b x}{2}-\frac {a \cos \left (2 x \right )}{4}-\frac {b \sin \left (2 x \right )}{4}\) \(20\)
default \(-\frac {\left (\cos ^{2}\left (x \right )\right ) a}{2}+b \left (-\frac {\cos \left (x \right ) \sin \left (x \right )}{2}+\frac {x}{2}\right )\) \(21\)
meijerg \(\frac {a \sqrt {\pi }\, \left (\frac {1}{\sqrt {\pi }}-\frac {\cos \left (2 x \right )}{\sqrt {\pi }}\right )}{4}+\frac {b \sqrt {\pi }\, \left (\frac {2 x}{\sqrt {\pi }}-\frac {\sin \left (2 x \right )}{\sqrt {\pi }}\right )}{4}\) \(43\)
norman \(\frac {b \left (\tan ^{3}\left (\frac {x}{2}\right )\right )+2 a \left (\tan ^{2}\left (\frac {x}{2}\right )\right )+b x \left (\tan ^{2}\left (\frac {x}{2}\right )\right )+\frac {b x}{2}-b \tan \left (\frac {x}{2}\right )+\frac {b x \left (\tan ^{4}\left (\frac {x}{2}\right )\right )}{2}}{\left (1+\tan ^{2}\left (\frac {x}{2}\right )\right )^{2}}\) \(60\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(x)*(a*cos(x)+b*sin(x)),x,method=_RETURNVERBOSE)

[Out]

-1/2*cos(x)^2*a+b*(-1/2*cos(x)*sin(x)+1/2*x)

________________________________________________________________________________________

Maxima [A]
time = 0.35, size = 21, normalized size = 0.84 \begin {gather*} -\frac {1}{2} \, a \cos \left (x\right )^{2} + \frac {1}{4} \, b {\left (2 \, x - \sin \left (2 \, x\right )\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)*(a*cos(x)+b*sin(x)),x, algorithm="maxima")

[Out]

-1/2*a*cos(x)^2 + 1/4*b*(2*x - sin(2*x))

________________________________________________________________________________________

Fricas [A]
time = 3.04, size = 19, normalized size = 0.76 \begin {gather*} -\frac {1}{2} \, a \cos \left (x\right )^{2} - \frac {1}{2} \, b \cos \left (x\right ) \sin \left (x\right ) + \frac {1}{2} \, b x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)*(a*cos(x)+b*sin(x)),x, algorithm="fricas")

[Out]

-1/2*a*cos(x)^2 - 1/2*b*cos(x)*sin(x) + 1/2*b*x

________________________________________________________________________________________

Sympy [A]
time = 0.05, size = 37, normalized size = 1.48 \begin {gather*} \frac {a \sin ^{2}{\left (x \right )}}{2} + \frac {b x \sin ^{2}{\left (x \right )}}{2} + \frac {b x \cos ^{2}{\left (x \right )}}{2} - \frac {b \sin {\left (x \right )} \cos {\left (x \right )}}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)*(a*cos(x)+b*sin(x)),x)

[Out]

a*sin(x)**2/2 + b*x*sin(x)**2/2 + b*x*cos(x)**2/2 - b*sin(x)*cos(x)/2

________________________________________________________________________________________

Giac [A]
time = 0.40, size = 19, normalized size = 0.76 \begin {gather*} \frac {1}{2} \, b x - \frac {1}{4} \, a \cos \left (2 \, x\right ) - \frac {1}{4} \, b \sin \left (2 \, x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)*(a*cos(x)+b*sin(x)),x, algorithm="giac")

[Out]

1/2*b*x - 1/4*a*cos(2*x) - 1/4*b*sin(2*x)

________________________________________________________________________________________

Mupad [B]
time = 0.41, size = 19, normalized size = 0.76 \begin {gather*} \frac {a\,{\sin \left (x\right )}^2}{2}-\frac {b\,\cos \left (x\right )\,\sin \left (x\right )}{2}+\frac {b\,x}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(x)*(a*cos(x) + b*sin(x)),x)

[Out]

(a*sin(x)^2)/2 + (b*x)/2 - (b*cos(x)*sin(x))/2

________________________________________________________________________________________